home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib8 / v_10_12 / 1012014b < prev    next >
Encoding:
Text File  |  1995-11-01  |  246 b   |  14 lines

  1. /* strchr function */
  2. #include <string.h>
  3.  
  4. char *(strchr)(const char *s, int c)
  5.     {    /* find first occurrence of c in char s[] */
  6.     const char ch = c;
  7.  
  8.     for (; *s != ch; ++s)
  9.         if (*s == '\0')
  10.             return (NULL);
  11.     return ((char *)s);
  12.     }
  13.  
  14.